Add an interface to support flushing by TsFileResource#17203
Add an interface to support flushing by TsFileResource#17203
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds a new interface to support flushing by TsFileResource and implements idempotency for flushing operations. When the same TsFile is flushed multiple times before completion, it returns the same Future object.
Changes:
- Added a new
asyncCloseOneTsFileProcessor(TsFileResource)method that accepts a TsFileResource instead of requiring explicit sequence flag and processor parameters - Introduced a
closeFuturefield in TsFileProcessor to cache the Future returned by asyncClose(), enabling idempotent flush operations - Refactored the existing
asyncCloseOneTsFileProcessor(boolean, TsFileProcessor)method to check for and return cached closeFuture - Added test coverage for the new idempotent flush behavior
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| DataRegionTest.java | Changed assertTrue imports from qualified to static import, added new test testFlushSpecifiedResource() to verify idempotent flush behavior |
| TsFileProcessor.java | Added closeFuture field and modified syncClose()/asyncClose() methods to cache and return the same Future for repeated close operations |
| DataRegion.java | Added new public asyncCloseOneTsFileProcessor(TsFileResource) overload and refactored existing method to use closeFuture-based idempotency check |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...ode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java
Outdated
Show resolved
Hide resolved
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
Show resolved
Hide resolved
...ode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java
Show resolved
Hide resolved
...ode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java
Outdated
Show resolved
Hide resolved
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
Show resolved
Hide resolved
...core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/DataRegionTest.java
Show resolved
Hide resolved
...core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/DataRegionTest.java
Show resolved
Hide resolved
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
Show resolved
Hide resolved
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
Show resolved
Hide resolved
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #17203 +/- ##
============================================
- Coverage 39.50% 39.50% -0.01%
Complexity 282 282
============================================
Files 5101 5101
Lines 341889 341895 +6
Branches 43525 43525
============================================
Hits 135069 135069
- Misses 206820 206826 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|




And, flushing the same TsFile multiple times will result in the same future, as long as the flush does not complete.
This interface is provided for the pipe to actively flush the downgraded files.